package com.teatrace.model.produce;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.teatrace.model.base.Device;
import com.teatrace.model.base.Employee;


/**
 * 茶林培育实体
 * 
 * 对应数据库中的表teatrees_breed
 */
@Entity
@Table(name="teatrees_breed")
public class TeaTreesBreed {

	@Id
	@Column(name="teatrees_breed_id")
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;//teatrees_breed_id
	
	@ManyToOne
	@JoinColumn(name="teatrees_id",updatable=false)
	private TeaTrees teaTrees;
	
	//培育的方式
	private String type;
	
	@Column(name="breed_time",columnDefinition="date")
	private String breedTime;
	
	private String description;
	
	@Column(columnDefinition="int")
	private boolean deleted;

	
	@ManyToMany(fetch=FetchType.EAGER,cascade={CascadeType.MERGE,CascadeType.REFRESH,CascadeType.PERSIST})
	@JoinTable(
		name="r_employee_teatreesbreed",
		joinColumns=@JoinColumn(name="teatrees_breed_id"),
		inverseJoinColumns=@JoinColumn(name="employee_id")
	)
	private Set<Employee> emps;

	@ManyToMany(fetch=FetchType.EAGER,cascade={CascadeType.MERGE,CascadeType.REFRESH,CascadeType.PERSIST})
	@JoinTable(
		name="r_device_teatreesbreed",
		joinColumns=@JoinColumn(name="teatrees_breed_id"),
		inverseJoinColumns=@JoinColumn(name="device_id")
	)
	private Set<Device> devices;

	
	public Set<Employee> getEmps() {
		return emps;
	}

	public void setEmps(Set<Employee> emps) {
		this.emps = emps;
	}

	public Set<Device> getDevices() {
		return devices;
	}

	public void setDevices(Set<Device> devices) {
		this.devices = devices;
	}

	public TeaTrees getTeaTrees() {
		return teaTrees;
	}

	public String getType() {
		return type;
	}

	public String getBreedTime() {
		return breedTime;
	}

	public String getDescription() {
		return description;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setTeaTrees(TeaTrees teaTrees) {
		this.teaTrees = teaTrees;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setBreedTime(String breedTime) {
		this.breedTime = breedTime;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getId() {
		return id;
	}

	
	

	
	
}
